<%-- 
    Document   : form_add_dept
    Created on : Nov 22, 2013, 3:09:43 PM
    Author     : zraj
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<script type="text/javascript">
     
     function addDept(){
         
        if($('#departmentID').val().length == 0)
        {
            alert('กรุณากรอกรหัสหน่วยงาน');
        }else
        {
            if($('#departmentName').val().length == 0){
                alert('กรุณากรอกชื่อหน่วยงาน');
            }else
            {
                $('#form-dept-detail').attr("action","addDept.action");
           //alert($('#departmentName').val());
                $('#form-dept-detail').submit();
            }
            
            
        }
         
       
     }
      function deleteDept(){
        $('#form-dept-detail').attr("action","deleteDept.action");
        $('#form-dept-detail').submit();
     }
     
     
</script>

<s:form id="form-dept-detail" action="" method="post" acceptcharset="UTF-8">
    <s:hidden name="dept.departmentID" value="%{dept.departmentID}"></s:hidden>
    <s:textfield  label="รหัสหน่วยงาน" id="departmentID" name="newDept.departmentID" value=""  ></s:textfield>
    <s:textfield label="ชื่อหน่วยงาน" id="departmentName"  name="newDept.departmentName" value=""></s:textfield>
   
</s:form>
<br/>
<sj:a href="#" onclick="addDept()" button="true">เพิ่ม</sj:a>   
<sj:a href="#" onclick="history.back()" button="true">ยกเลิก</sj:a>   

